<style lang="scss" scoped>
	@import '@/assets/css/variable';
	.zixun {
		width: 100%;
		background-color: $main-bgc-gray;
		min-height: 100%;
		font-size: 1.2rem;
		box-sizing: border-box;
		position: absolute;
		top: 0;
		bottom: 0;
		.searchBox{
			height: 80px;
		}
		.listBox{
			background-color: $main-bgc-white;
			overflow-y: scroll;
			position: absolute;
			top: 80px;
			width: 100%;
			bottom: 0;
			box-sizing: border-box;
			.load-more{
				font-size: 14px;
				width: 90% !important;
				margin: 10px auto;
			}
		}
	}
</style>
<template>
	<div class="zixun">
		<div ref="searchBox">
			<search-box-aticle></search-box-aticle>
		</div>
		<div class="splitLine"></div>
		<div class="listBox">
			<!-- <van-list v-model="loading" :finished="finished" finished-text="没有更多了" offset="100">
				
			</van-list> -->
			<zixun-list :list="zixunList"></zixun-list>
			<div v-if="finished==false">
				<van-button class="load-more margB-l" :loading="loading" block @click="ArticleH5Artpage">加载更多</van-button>
				
			</div>
			<div class="no-data color-s padding-all-m" v-if="finished">已经到底了</div>
		</div>
	</div>
</template>

<script>
	// @ is an alias to /src
	import SearchBoxAticle from '@/components/SearchBoxAticle.vue'
	import ZixunList from '@/components/zixunList.vue'
	import {
		myMixins
	} from "@/assets/js/mixins.js"
	export default {
		name: "zixun",
		mixins: [myMixins],
		components: {
			SearchBoxAticle,ZixunList
		},
		data() {
			return {
				selectedCampus:'',
				zixunList:[],
				pageNo:1,
				pageSize:8,
				loading: false,
				finished: false,
			}
		},
		created() {
			const _this = this;
			const selectedCampus = JSON.parse(localStorage.getItem('selectedCampus'))
			this.selectedCampus = selectedCampus
			this.ArticleH5Artpage()
		},
		mounted() {
			// document.title = '活动管理'
			// this.zixunList = this.$store.state.zixunList
			
		},
		methods: {
			ArticleH5Artpage() {
				const _this = this;
				const campus_id = _this.selectedCampus.id
				let params = {
					// openid: _this.$store.state.openid || localStorage.getItem('openid'),
					campus_id: campus_id,
					pageNo:this.pageNo,
					pageSize:this.pageSize
				}
				_this.$request.ArticleH5Artpage(params).then(res => {
					//_this.zixunList = res.data.data
					let data = res.data.data
					_this.zixunList.push(...data)
					if (_this.pageNo >= (Math.ceil(res.data.totalCount / _this.pageSize))) {
						_this.finished = true;
					} else {
						_this.pageNo++
					}
					// this.carousel = res.data.data
					// this.$store.commit('setCaseList', this.caseList);
				}).finally(res=>{
					this.loading = false
				})
			},
		}
	};
</script>
